FUNCTION_BLOCK DAC_DwordTo4Bytes 
TITLE = 'DAC_DwordTo4Bytes'
//
// This functionblock build 4 single bytes of a dword  
// 
// Versionshistory:
// 1.0 Ersterstellung E.Dittmann

VERSION : '1.0'
AUTHOR  : 'Lenze'
FAMILY  : 'DAC'
NAME : '4byOfdw'
KNOW_HOW_PROTECT

VAR_INPUT
    dwInput:                     DWORD;                             // Inputdword
END_VAR
    

VAR_OUTPUT
    byOutput1:                    BYTE;                              // Outputbyte 1
    byOutput2:                    BYTE;                              // Outputbyte 2
    byOutput3:                    BYTE;                              // Outputbyte 3
    byOutput4:                    BYTE;                              // Outputbyte 3
END_VAR
    
VAR
END_VAR

BEGIN

    byOutput1:=DWORD_TO_BYTE(dwInput);
    byOutput2:=DWORD_TO_BYTE(SHR(IN:=dwInput,N:=8));
    byOutput3:=DWORD_TO_BYTE(SHR(IN:=dwInput,N:=16));
    byOutput4:=DWORD_TO_BYTE(SHR(IN:=dwInput,N:=24));

    
END_FUNCTION_BLOCK

